package help_util;

import sudoku_properties.BasicSudokuParam;

/* To handle the communication between models */
public class IndexConverter{

    /* return 1 to 81 index */
    public static int getIndex(int cellIndexX, int cellIndexY){
       return cellIndexY * NUM_CELLS_IN_UNIT + cellIndexX + 1;
    }
    public static int getHorizontalIndex( int cellIndex ){
        return (cellIndex - 1) % NUM_CELLS_IN_UNIT;
    }
    public static int getVerticalIndex( int cellIndex ){
        return (cellIndex - 1) / NUM_CELLS_IN_UNIT;
    }

    /* Common variables */
    final static int NUM_CELLS_IN_UNIT = BasicSudokuParam.getNumCellsInUnit();

}
